<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="crm.model.Employees"%>
<%@page import="crm.util.ParamUtil"%>
<%@page import="crm.model.Custom_require"%>
<%@page import="java.util.Date"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="crm.control.CustomRequieControl"%>
<%@page import="com.sun.java.swing.plaf.windows.resources.windows"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
         request.setCharacterEncoding("UTF-8");
         Employees cu = (Employees) session.getAttribute("user");
         
         String system_name = ParamUtil.getString(request,"system_name");
         String require_book_id = ParamUtil.getString(request,"require_book_id");
         String model_name = ParamUtil.getString(request,"model_name");
         String function = ParamUtil.getString(request,"function");
         String[] type1 = ParamUtil.getStringArray(request,"lb");
         System.out.println(type1.length);
         String link_play = ParamUtil.getString(request,"link_play");
         String offer_depart = ParamUtil.getString(request,"offer_depart");
         String offer_person = ParamUtil.getString(request,"offer_person");
         String deserve_depart = ParamUtil.getString(request,"deserve_depart");
         
         String description = ParamUtil.getString(request,"description");
         Date dt = new Date(); 
         SimpleDateFormat matter1 = new SimpleDateFormat("yyyy-MM-dd");
         String date = matter1.format(dt);
         
         Custom_require customRequire = new Custom_require();
         customRequire.setSystem_name(system_name);
         customRequire.setRequire_book_id(require_book_id);
         customRequire.setModel_name(model_name);
         customRequire.setFunction(function);
         String type = ""; 
          for(int i=0;i<type1.length;i++){
             
             type = type+"@"+String.valueOf(type1[i]);
             customRequire.setType(type);
         }
         customRequire.setLink_play(link_play);
         customRequire.setOffer_depart(offer_depart);
         customRequire.setOffer_person(offer_person);
         customRequire.setDeserve_depart(deserve_depart);
         customRequire.setDeserve_person(cu.getId());
         customRequire.setDescription(description);
         customRequire.setDate(date);
         if(CustomRequieControl.addCustomRequire(customRequire)){%>
         <script>
             window.alert("添加成功")
             window.top.location.href="show_all_custom_require.jsp"
         </script>
         <%}else{%>
         <script>
             window.alert("添加失败")
             window.top.location.href="show_all_custom_require.jsp"
         </script>
         <%} %>
</body>
</html>